package gui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;

import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextArea;

public class ChatWindowV2 extends JFrame implements Runnable{
	private static final long serialVersionUID = 1L;
	JPanel contentPane;
	String name;
	String address;
	int port;


	
	public ChatWindowV2(){}
	public ChatWindowV2(String name) {
		this.name = name;
		this.address = "";
		this.port = 6666;
		run();
	}
	
	public void run() {
		contentPane = new JPanel();
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		this.setBounds(100, 100, 600, 400);
		this.setBackground(Color.BLACK);
		this.setContentPane(contentPane);
		contentPane.setLayout(new BorderLayout(5, 0));
		
		JPanel chat = createChat();
		JPanel buttons = createButtons();
		
		
		
		contentPane.add(chat, BorderLayout.WEST);
		
		
		contentPane.add(buttons, BorderLayout.EAST);
		this.setTitle(name);
        this.setVisible(true);
        this.setResizable(false);
        this.validate();
	}
	
	public JPanel createChat(){
		JPanel chat = new JPanel();
		JTextArea textArea = new JTextArea();
		JScrollPane chatWindow= new JScrollPane(textArea);
		chat.setLayout(new BorderLayout(0, 5)); 
		chat.setBackground(Color.GREEN);
		chat.setPreferredSize(new Dimension(400, 400));
		chat.setMaximumSize(new Dimension(400, 400));
		chat.setMinimumSize(new Dimension(400, 400));
		return chat;
	}
	
	public JPanel createButtons(){
		JPanel buttons = new JPanel();
		buttons.setBackground(Color.CYAN);
		
		return buttons;
	}

}
